package com.wenwen.social.controller.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class QueryResultVO<T> extends ResultVO<T> {
	private Long totalNum = 0L;
	private Integer code;
	private T data;
	private String msg;


	public static <T> ResultVO success(Long totalNum, T data) {
		QueryResultVO<T> tQueryResultVO = new QueryResultVO<>();
		tQueryResultVO.code = 200;
		tQueryResultVO.data = data;
		tQueryResultVO.msg = "";
		tQueryResultVO.totalNum = totalNum;
		return tQueryResultVO;
	}

	public static <T> ResultVO fail(String msg) {
		QueryResultVO<T> tQueryResultVO = new QueryResultVO<>();
		tQueryResultVO.code = 200;
		tQueryResultVO.msg = msg;
		return tQueryResultVO;
	}
}
